﻿<!DOCTYPE html>
<html>
  <head>
    <script src="jquery-1.4.3.min.js"></script>
    <script src="oauth.js"></script>
    <script src="sha1.js"></script>
    <script src="oauth_twitter_core.js"></script>
  </head>
  <body>
    <script type="text/javascript">

  var OAUTH_CONSUMER_KEY    = 'jQjDD1gR1ZS62N6oezz0A' ;
  var OAUTH_CONSUMER_SECRET = '7KwLgjsSPoUghg4ACYbszBckZC8FEJJRiKXxiSqfbw' ;

  var currentPageUrl = '' ;

  var core = new OAuthTwitterCore( OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET ) ;

  function postStatus( text, callback ) {
    core.updateStatus( text, callback ) ;
  }

  function onRequest( request, sender, callback ) {

    if( request.action == 'url' ) {
      currentPageUrl = request.url ;
    } else if( core.isLogined( ) ) {
      if( request.action == 'timeline' ) {
        core.getHomeTimeline( callback ) ;
      }
      if( request.action == 'postMessage' ) {
        core.updateStatus( request.text, callback ) ;
      }
    } else {
      if( request.action == 'getAccessToken' ) {
        core.getAccessToken( request.verifier ) ;
      } else {
        core.getRequestToken( callback ) ;
      }
    }

  }

  function onClicked( ) {

  }

  chrome.extension.onRequest.addListener( onRequest ) ;
  chrome.browserAction.onClicked.addListener( onClicked ) ;

    </script>
  </body>
</html>
